import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [{
    path: '/',
    name: 'Home',
    component: Home
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: () => import( /* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path: '/city/:city',
    name: 'City',
    // 异步加载
    component: () => import( /* webpackChunkName: "about" */ '../views/City.vue')
  },
  {
    // 风险地区
    path: '/area',
    name: 'Area',
    component: () => import( /* webpackChunkName: "about" */ '../views/Covid/Covidnav/Area.vue')
  },
  {
    // 核酸检测
    path: '/test',
    name: 'Test',
    component: () => import( /* webpackChunkName: "about" */ '../views/Covid/Covidnav/Test.vue')
  },
  {
    // 防疫物资
    path: '/prevention',
    name: 'Prevention',
    component: () => import( /* webpackChunkName: "about" */ '../views/Covid/Covidnav/Prevention.vue')
  },
  {
    // 出行政策
    path: '/travel',
    name: 'Travel',
    component: () => import( /* webpackChunkName: "about" */ '../views/Covid/Covidnav/Travel.vue')
  },

]

const router = new VueRouter({
  // mode: 'history',
  mode: 'hash',
  base: process.env.BASE_URL,
  routes
})

export default router